package com.example.springboot.modules.system.controller;


import com.example.springboot.common.entity.TableResult;
import com.example.springboot.modules.system.model.AutSysUser;
import com.example.springboot.modules.system.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping(value="/list")
    public TableResult<AutSysUser> list(AutSysUser autSysUser){
        TableResult<AutSysUser> result=new TableResult<>();
        PageInfo<AutSysUser> pageInfo=userService.list(autSysUser);
        result.setCount(pageInfo.getTotal());
        result.setData(pageInfo.getList());
        return result;
    }

    @RequestMapping("/welcome")
    public String welcome(){
        return "welcome";
    }
}